﻿<rsw:ResizableWindow x:Class="TsfManager.MainWindow"        
        xmlns:rsw="clr-namespace:GSF.TimeSeries.UI;assembly=GSF.TimeSeries.UI.WPF"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="800" Width="900"    
        xmlns:tsfconv="clr-namespace:GSF.TimeSeries.UI.Converters;assembly=GSF.TimeSeries.UI"
        xmlns:tsf="clr-namespace:GSF.TimeSeries.UI;assembly=GSF.TimeSeries.UI.WPF"
        Background="{StaticResource MainBackgroundBrush}" FontSize="{StaticResource SmallTextSize}">
        
    <Window.Resources>        
        <tsfconv:RoleBasedVisibilityConverter x:Key="roleBasedVisibilityConverter" />
        <HierarchicalDataTemplate DataType="{x:Type tsf:MenuDataItem}" ItemsSource="{Binding Path=SubMenuItems}">            
            <ContentPresenter Content="{Binding Path=MenuText}" RecognizesAccessKey="True"/>            
        </HierarchicalDataTemplate>        
    </Window.Resources>

    <Canvas VerticalAlignment="Top" HorizontalAlignment="Left" Background="Transparent">
        <Canvas.RenderTransform>
            <ScaleTransform ScaleX="1" ScaleY="1"/>
        </Canvas.RenderTransform>

        <StackPanel Orientation="Vertical">
            <StackPanel.Resources>
                <ResourceDictionary>
                    <ResourceDictionary.MergedDictionaries>
                        <ResourceDictionary Source="/GSF.TimeSeries.UI.WPF;Component/Resources/CommonResource.xaml" />
                    </ResourceDictionary.MergedDictionaries>
                </ResourceDictionary>
            </StackPanel.Resources>

            <tsf:TsfPopup x:Name="PopupStatus" Topmost="False" Placement="Relative" PlacementTarget="{Binding ElementName=GroupBoxMain}" HorizontalOffset="250">
                <Border CornerRadius="5" BorderThickness="2" Background="White" BorderBrush="Blue">
                    <TextBlock x:Name="TextBlockResult" FontSize="{StaticResource LargeTextSize}" Height="Auto"/>
                </Border>
            </tsf:TsfPopup>

            <Grid Margin="0,5,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0">
                    <Image Source="/GSF.TimeSeries.UI;component/images/GPALock.png" ToolTip="Grid Protection Alliance"/>
                    <TextBlock x:Name="TextBoxTitle" Style="{StaticResource MainTitleStyle}" Margin="5,-10,0,0"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center">
                    <TextBlock Text="Current Node: " Foreground="White"/>
                    <ComboBox x:Name="ComboboxNode" DisplayMemberPath="Value" SelectionChanged="ComboboxNode_SelectionChanged" Width="150"/>
                    <Ellipse x:Name="EllipseConnectionState" Fill="{StaticResource RedRadialGradientBrush}" Width="16" Height="16" Margin="2,0,5,0" />
                    <Button x:Name="BackButton" Width="Auto" Height="Auto" ToolTip="Go Back" Margin="0,0,5,0" Click="ButtonBack_Click" IsEnabled="False">
                        <Button.Template>
                            <ControlTemplate>
                                <Grid>
                                    <Image Source="/GSF.TimeSeries.UI;component/images/BackGray.png" Height="24" Width="24" />
                                    <Image Source="/GSF.TimeSeries.UI;component/images/Back.png" Height="24" Width="24" Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsEnabled, Converter={StaticResource ObjectToVisibilityConverter}}" />
                                </Grid>
                            </ControlTemplate>
                        </Button.Template>
                    </Button>
                    <Button x:Name="ForwardButton" Width="Auto" Height="Auto" ToolTip="Go Forward" Margin="0,0,5,0" Click="ButtonForward_Click" IsEnabled="False">
                        <Button.Template>
                            <ControlTemplate>
                                <Grid>
                                    <Image Source="/GSF.TimeSeries.UI;component/images/ForwardGray.png" Height="24" Width="24" />
                                    <Image Source="/GSF.TimeSeries.UI;component/images/Forward.png" Height="24" Width="24" Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsEnabled, Converter={StaticResource ObjectToVisibilityConverter}}" />
                                </Grid>
                            </ControlTemplate>
                        </Button.Template>
                    </Button>
                </StackPanel>

                <Border Background="{StaticResource MenuBackgroundBrush}" BorderThickness="0" CornerRadius="5" VerticalAlignment="Top" 
                    Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="5,0,5,0" Width="875" Height="32">
                    <Menu x:Name="MenuMain" ItemsSource="{Binding}" Style="{StaticResource MenuStyle}" ItemContainerStyleSelector="{StaticResource MenuItemStyleSelector}"
                      HorizontalAlignment="Left"/>
                </Border>
            </Grid>

            <GroupBox x:Name="UserControlGroupBox" Margin="2,-5,2,2" MinHeight="675" FontSize="12">
                <Border Padding="2" BorderThickness="1" Background="{StaticResource MenuBackgroundBrush}" CornerRadius="5">
                    <StackPanel Name="UserControlParentPanel">
                        <StackPanel Name="UserControlPanel" Width="{Binding ElementName=UserControlParentPanel, Path=ActualWidth}" />
                    </StackPanel>
                </Border>
            </GroupBox>
        </StackPanel>
    </Canvas>
</rsw:ResizableWindow>
